<html>
<body>
Reports usages of the deprecated <code>kotlinOptions</code> DSL in Gradle <code>.kts</code> build scripts.
<p>
    The <code>kotlinOptions</code> DSL was deprecated in Kotlin 2.0.
    The inspection helps migrate from <code>kotlinOptions</code> to <code>compilerOptions</code>.
    It also changes the types of several
    <a href="https://kotl.in/types-for-kgp-compiler-options">options that use the new types</a> instead of the <code>String</code> type.
</p>
<p>
    Example for the <code>KotlinCompile</code> task:
</p>
<pre><code>
val compileKotlin: KotlinCompile by tasks
compileKotlin.kotlinOptions {
    jvmTarget = "1.8"
    freeCompilerArgs = listOf("-module-name", "my_module_name")
    apiVersion = "1.9"
}
</code></pre>

<p>The inspection also adds imports for options with changed types:</p>
<pre><code>
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion

...

val compileKotlin: KotlinCompile by tasks
compileKotlin.compilerOptions {
    jvmTarget.set(JvmTarget.JVM_1_8)
    freeCompilerArgs.set(listOf("-module-name", "my_module_name"))
    apiVersion.set(KotlinVersion.KOTLIN_1_9)
}
</code></pre>

<p>
    Example for the <code>Kotlin2JsCompile</code> task:
</p>
<pre><code>
val compileKotlin: Kotlin2JsCompile by tasks
compileKotlin.kotlinOptions {
    moduleKind = "commonjs"
    sourceMapEmbedSources = "inlining"
    sourceMapNamesPolicy = "fully-qualified-names"
    main = "noCall"
}
</code></pre>

<p>After the inspection is applied:</p>
<pre><code>
import org.jetbrains.kotlin.gradle.dsl.JsMainFunctionExecutionMode
import org.jetbrains.kotlin.gradle.dsl.JsModuleKind
import org.jetbrains.kotlin.gradle.dsl.JsSourceMapEmbedMode
import org.jetbrains.kotlin.gradle.dsl.JsSourceMapNamesPolicy

...

val compileKotlin: Kotlin2JsCompile by tasks
compileKotlin.compilerOptions {
    moduleKind.set(JsModuleKind.MODULE_COMMONJS)
    sourceMapEmbedSources.set(JsSourceMapEmbedMode.SOURCE_MAP_SOURCE_CONTENT_INLINING)
    sourceMapNamesPolicy.set(JsSourceMapNamesPolicy.SOURCE_MAP_NAMES_POLICY_FQ_NAMES)
    main.set(JsMainFunctionExecutionMode.NO_CALL)
}
</code></pre>